//
//  SqDetailViewController.m
//  FengyuanXS
//
//  Created by 王冬 on 2020/8/3.
//  Copyright © 2020 王冬. All rights reserved.
//

#import "SqDetailViewController.h"

@interface SqDetailViewController ()
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;


@property (weak, nonatomic) IBOutlet UILabel *shenqLabel;
@property (weak, nonatomic) IBOutlet UILabel *bumenLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *typeLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@end

@implementation SqDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"诉求详情";
        self.nameLabel.text = [NSString stringWithFormat:@"%@提交的%@",self.model.real_name,self.model.type_name];
        self.shenqLabel.text = self.model.real_name;
        self.bumenLabel.text = self.model.section_name;
        self.timeLabel.text = [self ConvertStrToTime:self.model.create_time];
        self.typeLabel.text = self.model.type_name;
        self.contentLabel.text = self.model.content;
   
    // Do any additional setup after loading the view.
}
//时间戳变为格式时间
- (NSString *)ConvertStrToTime:(NSString *)timeStr{
    
    long long time=[timeStr longLongValue];
    //    如果服务器返回的是13位字符串，需要除以1000，否则显示不正确(13位其实代表的是毫秒，需要除以1000)
    //    long long time=[timeStr longLongValue] / 1000;
    
    NSDate *date = [[NSDate alloc]initWithTimeIntervalSince1970:time];
    
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    
    [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    
    NSString*timeString=[formatter stringFromDate:date];
    
    return timeString;
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
